From a793a715fabfdae29960ab43d46e5354b8e9ee37 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Thu, 1 Jul 2010 19:55:04 +0000 Subject: [PATCH] (bug 24022) Don't check extensions of files in uploadpage script when $wgStrictFileExtensions == false --- RELEASE-NOTES | 1 + includes/specials/SpecialUpload.php | 3 ++- skins/common/upload.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 198ad31a2b..7b0049767e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -221,6 +221,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 23642) Recognize mime types of MS OpenXML documents. * (bug 22784) Normalise underscores and spaces in autocomments. * (bug 19910) Headings of the form ===+\s+ are now displayed as valid headings +* (bug 24022) Only check file extensions on the uploadpage when needed. === API changes in 1.17 === * (bug 22738) Allow filtering by action type on query=logevent. diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 681fcfc66c..dc1da4aedb 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -1044,7 +1044,7 @@ class UploadForm extends HTMLForm { * Add upload JS to $wgOut */ protected function addUploadJS() { - global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI; + global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI, $wgStrictFileExtensions; global $wgOut; $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; @@ -1058,6 +1058,7 @@ class UploadForm extends HTMLForm { // the wpDestFile textbox $this->mDestFile === '', 'wgUploadSourceIds' => $this->mSourceIds, + 'wgStrictFileExtensions' => $wgStrictFileExtensions, ); $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); diff --git a/skins/common/upload.js b/skins/common/upload.js index fc16ebca48..55f8c69eef 100644 --- a/skins/common/upload.js +++ b/skins/common/upload.js @@ -242,7 +242,7 @@ function fillDestFilename(id) { // Clear the filename if it does not have a valid extension. // URLs are less likely to have a useful extension, so don't include them in the // extension check. - if( wgFileExtensions && id != 'wpUploadFileURL' ) { + if( $wgStrictFileExtensions && wgFileExtensions && id != 'wpUploadFileURL' ) { var found = false; if( fname.lastIndexOf( '.' ) != -1 ) { var ext = fname.substr( fname.lastIndexOf( '.' ) + 1 ); -- 2.20.1